<!DOCTYPE html>
<!--头部公共部分-->
{include file="common/header" /}

<div class="x-nav">
      <span class="layui-breadcrumb">
        <a>首页</a>
        <a>教务</a>
        <a>
          <cite>课消总览</cite></a>
      </span>
    <a class="layui-btn layui-btn-xs layui-btn-small" style="float:right;margin-top: 10px;"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon layui-icon-refresh"></i> </a>
</div>
<div class="layui-tab layui-tab-card" lay-filter="filter">
    <ul class="layui-tab-title">
        <li class="layui-this">按班级总览</li>
        <li>按学员总览</li>
        <li>按老师总览</li>
        <li>按班主任总览</li>
        <li>课消明细总览</li>
        <li>课消图形报表总览</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <div class="layui-row">
                <div class="layui-form layui-col-md12 x-so layui-form-pane" style="margin-left: 20px;">
                    <div class="layui-input-inline">
                        <select name="campus_id_grades" lay-verify="required" lay-search="">
                            <option value="">选择校区</option>
                            {volist name="campus_name" id="campu"}
                            <option value="{$campu.id}">{$campu.campus_name}</option>
                            {/volist}
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" style="width: auto" placeholder="开始时间-结束时间" name="class_date_grades" id="start_grades">
                    </div>
                    <div class="layui-input-inline">
                        <select name="grades_type_name" lay-search="">
                            <option value="">班级类型</option>
                            {volist name="data[9]" id="vo"}
                            <option value="{$vo.id}">{$vo.name}</option>
                            {/volist}
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="course_id_grades" lay-search="">
                            <option value="">课程名称</option>
                            {volist name="course_list" id="vo"}
                            <option value="{$vo.id}">{$vo.course_name}</option>
                            {/volist}
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="grades_name" lay-search="">
                            <option value="">班级名称</option>
                            {volist name="grades_list" id="vo"}
                            <option value="{$vo.grades_name}">{$vo.grades_name}</option>
                            {/volist}
                        </select>
                    </div>

                    <div class="layui-input-inline">
                        <button class="layui-btn" data-type="reload" id="search_grades">筛选</button>
                        <button class="layui-btn layui-btn-danger" id="clear_grades">重置</button>
                    </div>
                </div>
            </div>
            <div class="x-body">
                <table class="layui-table" id="datalist_grades" lay-filter="Event"></table>
            </div>
        </div>
        <div class="layui-tab-item">
            <div class="layui-row">
                <div class="layui-form layui-col-md12 x-so layui-form-pane" style="margin-left: 20px;">
                    <div class="layui-input-inline">
                        <select name="campus_id_student" lay-verify="required" lay-search="">
                            <option value="">选择校区</option>
                            {volist name="campus_name" id="campu"}
                            <option value="{$campu.id}">{$campu.campus_name}</option>
                            {/volist}
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" style="width: auto" placeholder="开始时间-结束时间" name="date_student_time" id="start_student">
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" style="width: auto" placeholder="学员姓名" name="student_name" id="student_name">
                    </div>

                    <div class="layui-input-inline">
                        <button class="layui-btn" data-type="reload" id="search_student">筛选</button>
                        <button class="layui-btn layui-btn-danger" id="clear_student">重置</button>
                    </div>
                </div>
            </div>
            <div class="x-body">
                <table class="layui-table" id="datalist_student" lay-filter="Event"></table>
            </div>
        </div>
        <div class="layui-tab-item">
            <div class="layui-row">
                <div class="layui-form layui-col-md12 x-so layui-form-pane" style="margin-left: 20px;">
                    <div class="layui-input-inline">
                        <select name="campus_id_teacher" lay-verify="required" lay-search="">
                            <option value="">选择校区</option>
                            {volist name="campus_name" id="campu"}
                            <option value="{$campu.id}">{$campu.campus_name}</option>
                            {/volist}
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" style="width: auto" placeholder="开始时间-结束时间" name="date_teacher_time" id="start_teacher">
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" style="width: auto" placeholder="老师姓名" name="teacher_name" id="teacher_name">
                    </div>

                    <div class="layui-input-inline">
                        <button class="layui-btn" data-type="reload" id="search_teacher">筛选</button>
                        <button class="layui-btn layui-btn-danger" id="clear_teacher">重置</button>
                    </div>

                </div>
            </div>
            <div class="x-body">
                <table class="layui-table" id="datalist_teacher" lay-filter="Event"></table>
            </div>
        </div>
        <div class="layui-tab-item">
            <div class="layui-row">
                <div class="layui-form layui-col-md12 x-so layui-form-pane" style="margin-left: 20px;">
                    <div class="layui-input-inline">
                        <select name="campus_id_headmaster" lay-verify="required" lay-search="">
                            <option value="">选择校区</option>
                            {volist name="campus_name" id="campu"}
                            <option value="{$campu.id}">{$campu.campus_name}</option>
                            {/volist}
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" style="width: auto" placeholder="开始时间-结束时间" name="date_headmaster_time" id="start_headmaster">
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" style="width: auto" placeholder="班主任姓名" name="headmaster_name" id="headmaster_name">
                    </div>

                    <div class="layui-input-inline">
                        <button class="layui-btn" data-type="reload" id="search_headmaster">筛选</button>
                        <button class="layui-btn layui-btn-danger" id="clear_headmaster">重置</button>
                    </div>

                </div>
            </div>
            <div class="x-body">
                <table class="layui-table" id="datalist_headmaster" lay-filter="Event"></table>
            </div>
        </div>
        <div class="layui-tab-item">
            <div class="layui-row">
                <div class="layui-form layui-col-md12 x-so layui-form-pane" style="margin-left: 20px;">
                    <div class="layui-input-inline">
                        <select name="campus_id_info" lay-verify="required" lay-search="">
                            <option value="">选择校区</option>
                            {volist name="campus_name" id="campu"}
                            <option value="{$campu.id}">{$campu.campus_name}</option>
                            {/volist}
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" style="width: auto" placeholder="开始时间-结束时间" name="date_info_time" id="start_info">
                    </div>
                    <div class="layui-input-inline">
                        <select name="course_id_info" lay-search="">
                            <option value="">课程名称</option>
                            {volist name="course_list" id="vo"}
                            <option value="{$vo.id}">{$vo.course_name}</option>
                            {/volist}
                        </select>
                    </div>

                    <div class="layui-input-inline">
                        <select name="grades_type_info" lay-search="">
                            <option value="">班型</option>
                            {volist name="data[9]" id="vo"}
                            <option value="{$vo.id}">{$vo.name}</option>
                            {/volist}
                        </select>
                    </div>

                    <div class="layui-input-inline">
                        <select name="grades_name_info" lay-search="">
                            <option value="">班级名称</option>
                            {volist name="grades_list" id="vo"}
                            <option value="{$vo.id}">{$vo.grades_name}</option>
                            {/volist}
                        </select>
                    </div>


                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" style="width: auto" placeholder="班主任姓名" name="headmaster_name_info" id="headmaster_name_info">
                    </div>

                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" style="width: auto" placeholder="老师姓名" name="teacher_name_info" id="teacher_name_info">
                    </div>

                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" style="width: auto" placeholder="助教姓名" name="assistant_name_info" id="assistant_name_info">
                    </div>

                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" style="width: auto" placeholder="学员姓名" name="student_name_info" id="student_name_info">
                    </div>





                    <div class="layui-input-inline">
                        <button class="layui-btn" data-type="reload" id="search_info">筛选</button>
                        <button class="layui-btn layui-btn-danger" id="clear_info">重置</button>
                    </div>

                </div>
            </div>
            <div class="x-body">
                <table class="layui-table" id="datalist_info" lay-filter="Event"></table>
            </div>
        </div>
        <div class="layui-tab-item">
            <div id="container" style="height: 550px;"></div>
            <div  class="x-body" class="clear:both;">
                <div style="position: absolute; top: 90px; width: auto; height: 100px;">
                    <div class="layui-form-item">
                        <div class="layui-inline" >
                            <label class="layui-form-label" style="width: auto;  color:#01AAED;font-weight: bold; font-size: 18px;">课消总金额:</label>
                            <label class="layui-form-label label"  style="width: auto;  color:#01AAED; font-weight: bold; font-size: 18px;">{$elimination_amount}(千元)</label>
                        </div>
                    </div>
                </div>
                <div style="position: absolute; top: 120px; width: auto; height: 100px;">
                    <div class="layui-form-item">
                        <div class="layui-inline" >
                            <label class="layui-form-label" style="width: auto;  color:#ef4136;font-weight: bold; font-size: 18px;">课消总课节:</label>
                            <label class="layui-form-label label_sum"  style="width: auto;  color:#ef4136; font-weight: bold; font-size: 18px;">{$elimination_sum}(课时)</label>
                        </div>
                    </div>
                </div>
                    <div class="layui-row" style="border-left:1px solid #e5e5e5;border-right:1px solid #e5e5e5;">
                        <div class="layui-form layui-col-md12 x-so layui-form-pane">
                            <div class="layui-input-inline">
                                <select name="campus_name" lay-search="" lay-verify="required">
                                    <option selected value=""></option>
                                    {foreach name="campus_name" id="vo"}
                                    <option value="{$vo.campus_name}">{$vo.campus_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <input type="text" style="width: 180px;" name="date_range"  id="range_date" placeholder="选择日期范围" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-input-inline">
                                <button class="layui-btn" id="search">
                                    <i class="layui-icon layui-icon-search"></i>筛选</button>
                                <button class="layui-btn layui-btn-danger" id="clear">
                                    <i class="layui-icon"></i>重置</button>

                            </div>
                        </div>
                    </div>
                    <script type="text/html" id="campus_name">
                        <a lay-event="see_info" class="layui-table-link">{{ d.campus_name }}</a>
                    </script>
                    <table class="layui-hide" id="LAY_table_user" lay-filter="Event"></table>
            </div>
        </div>
    </div>
</div>




<!--底部公共部分-->
{include file="common/footer" /}

<script>
    layui.use(['form', 'element', 'table','laydate', 'layer', 'laytpl'], function () {
        var $ = layui.$,
            form = layui.form,
            table = layui.table,
            laydate = layui.laydate,
            element = layui.element,
            layer = layui.layer;

      //  var loading = layer.load();

        element.on('tab(filter)', function(data) {
            console.log(this); //当前Tab标题所在的原始DOM元素
            console.log(data.index); //得到当前Tab的所在下标
            console.log(data.elem); //得到当前的Tab大容器

            if(data.index === 0){

            }
            if(data.index === 1){

            }
            if(data.index === 2){

            }
            if(data.index === 3){

            }
            if(data.index === 4){

            }
            if(data.index === 5){

                var dom = document.getElementById("container");
                var myChart = echarts.init(dom);
                var data_campus_elimination = eval('{$data_campus_elimination}');
                var elimination_sum =[];
                var elimination_amount =[];
                var campus_name =[];
                for(var i=0; i < data_campus_elimination.length; i++){

                    campus_name[i] = data_campus_elimination[i].campus_name;
                    elimination_sum[i] = data_campus_elimination[i].elimination_sum;
                    elimination_amount[i] = data_campus_elimination[i].elimination_amount;

                }
                option = null;
                option = {

                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {
                            type: 'shadow'
                        }
                    },

                    legend: {
                        right: 10,
                        data: ['课消','总金额【千元】']
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis: {
                        type: 'value',
                        boundaryGap: [0, 0.01]
                    },
                    yAxis: {
                        type: 'category',
                        data: campus_name,
                    },
                    series: [
                        {
                            name: '课消',
                            type: 'bar',
                            data:elimination_sum
                        },
                        {
                            name: '总金额【千元】',
                            type: 'bar',
                            data: elimination_amount
                        }
                    ]
                };
                if (option && typeof option === "object") {
                    myChart.setOption(option, true);
                }

            }
        });

        //日期
        laydate.render({
            elem: '#start_student',
            range: true
            ,trigger: 'click'
        });

        //日期
        laydate.render({
            elem: '#start_teacher',
            range: true
            ,trigger: 'click'
        });

        //日期
        laydate.render({
            elem: '#start_grades',
            range: true
            ,trigger: 'click'
        });


        //日期
        laydate.render({
            elem: '#start_info',
            range: true
            ,trigger: 'click'
        });

        //日期
        laydate.render({
            elem: '#start_headmaster',
            range: true
            ,trigger: 'click'
        });


        //数据表格 方法级渲染
        var tableIns = table.render({
            elem: '#LAY_table_user'
            , url: '{:url("elimination/eliminationlists")}'
            , method: 'POST'
            , toolbar: 'true' //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            , defaultToolbar: ['print', 'exports'] // 筛选图标
            , loading: true
            , parseData: function (res) { //res 即为原始返回的数据
                if (res.code === 1) {
                    res.code = 0;
                } else {
                    res.code = -1;
                }
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.data //解析数据列表
                };
            },
            cols: [[
                {field: 'campus_name', title: '校区',style:'cursor: pointer; color:#01AAED;font-weight: bold;', align: 'center',templet: '#campus_name'
                },{field: 'elimination_sum', title: '课时',style:'font-weight: bold;',  align: 'center'
                },{field: 'elimination_amount', title: '课消金额(元)', style:'font-weight: bold;',  align: 'center'
                },{field: 'elimination_no_amount', title: '欠费课消金额(元)',style:'font-weight: bold;', align: 'center'
                },{field: 'elimination_all_amount', title: '总金额(元)',style:'font-weight: bold;',  align: 'center'
                }
            ]]
            , height: 'full-180'
            , page: true
            , title: '课消报表'
            , limits: [10,20,30,40,50,60,70,80,90,10000000]
            , done: function () {
                layer.close(loading);
            }
        });

        //监听工具条
        table.on('tool(Event)', function (obj) {
            var data = obj.data; //获得当前行数据

            var layEvent = obj.event; //获得 lay-event 对应的值
            var tr = obj.tr; //获得当前行 tr 的DOM对象
            if(layEvent === 'see_info'){
                if(data.campus_name === '合计'){
                    layer.msg('【合计】栏目不可选中');
                    return;
                }
                layer.open({
                    skin: 'layui-layer-lan',
                    type: 2,
                    closeBtn: 2,
                    title: data.campus_name,
                    area: ['98%', '95%'],
                    shadeClose: false,
                    content: "{:url('elimination/class_report')}?id="+data.id,
                });
            }
        });

        //日期
        laydate.render({
            elem: '#range_date',
            range: true
            ,trigger: 'click'
        });
        //搜索项
        $('#search').click(function () {
            var field = {};
            field.campus_name = $('select[name=campus_name]').val();
            var create_date_rang = $('input[name=date_range]').val();
            if(create_date_rang.length > 0){
                strs_date=create_date_rang.split("-"); //字符分割
                field.start_date = strs_date[0]+'-'+strs_date[1]+'-'+strs_date[2];
                field.end_date = strs_date[3]+'-'+strs_date[4]+'-'+strs_date[5];
            }
            tableIns.reload({
                where: field,
                method: 'POST',
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });

            $.ajax({
                url: '/admin/Elimination/searcheliminationlists',
                method: "post",
                data: field,
                beforeSend: function () {
                    isLoad = layer.load(0, {
                        shade: false
                    }); //0代表加载的风格，支持0-2
                },
                success: function (result) {
                    //      layer.msg(result.msg);
                    if (result.code === 1) {

                        var campus_json_data = eval('(' + result.data + ')');
                        console.log(campus_json_data.campus_elimination_json);
                        $('.label').text(campus_json_data.campus_elimination_amount +'(千元)');
                        $('.label_sum').text(campus_json_data.campus_elimination_sum+'(课时)');


                        var dom = document.getElementById("container");
                        var myChart = echarts.init(dom);
                        var data_campus_elimination = campus_json_data.campus_elimination_json;
                        var elimination_sum =[];
                        var elimination_amount =[];
                        var campus_name =[];
                        for(var i=0; i < data_campus_elimination.length; i++){

                            campus_name[i] = data_campus_elimination[i].campus_name;
                            elimination_sum[i] = data_campus_elimination[i].elimination_sum;
                            elimination_amount[i] = data_campus_elimination[i].elimination_amount;

                        }
                        option = null;
                        option = {

                            tooltip: {
                                trigger: 'axis',
                                axisPointer: {
                                    type: 'shadow'
                                }
                            },

                            legend: {
                                right: 10,
                                data: ['课消','总金额【千元】']
                            },
                            grid: {
                                left: '3%',
                                right: '4%',
                                bottom: '3%',
                                containLabel: true
                            },
                            xAxis: {
                                type: 'value',
                                boundaryGap: [0, 0.01]
                            },
                            yAxis: {
                                type: 'category',
                                data: campus_name,
                            },
                            series: [
                                {
                                    name: '课消',
                                    type: 'bar',
                                    data:elimination_sum
                                },
                                {
                                    name: '总金额【千元】',
                                    type: 'bar',
                                    data: elimination_amount
                                }
                            ]
                        };
                        if (option && typeof option === "object") {
                            myChart.setOption(option, true);
                        }

                    }

                },
                complete: function () {
                    layer.close(isLoad)
                },
                error: function (error) {
                    console.log(error)
                }
            });

        });


        //清除
        $('#clear').click(function () {
            $('.layui-form-pane').find('.layui-input-inline').each(function (index, element) {
                $(element).find('input[type=text]').val('');
                $(element).find('select').val('');
            })
            tableIns.reload({
                where: {
                    'campus_name': '',
                    'start_date': '',
                    'end_date': '',
                    'date_range':'',
                },
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });


            $('.label').text('{$elimination_amount}' +'(千元)');
            $('.label_sum').text('{$elimination_sum}'+'(课时)');


            var dom = document.getElementById("container");
            var myChart = echarts.init(dom);
            var data_campus_elimination = eval('{$data_campus_elimination}');
            var elimination_sum =[];
            var elimination_amount =[];
            var campus_name =[];
            for(var i=0; i < data_campus_elimination.length; i++){

                campus_name[i] = data_campus_elimination[i].campus_name;
                elimination_sum[i] = data_campus_elimination[i].elimination_sum;
                elimination_amount[i] = data_campus_elimination[i].elimination_amount;

            }
            option = null;
            option = {

                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'shadow'
                    }
                },

                legend: {
                    right: 10,
                    data: ['课消','总金额【千元】']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: {
                    type: 'value',
                    boundaryGap: [0, 0.01]
                },
                yAxis: {
                    type: 'category',
                    data: campus_name,
                },
                series: [
                    {
                        name: '课消',
                        type: 'bar',
                        data:elimination_sum
                    },
                    {
                        name: '总金额【千元】',
                        type: 'bar',
                        data: elimination_amount
                    }
                ]
            };
            if (option && typeof option === "object") {
                myChart.setOption(option, true);
            }
        });


        //按班级总览
        //方法级渲染
        var tableIns_grades = table.render({
            elem: '#datalist_grades',
            url: '{:url("elimination/lists")}?type=' + 1,
            toolbar: 'true', //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            defaultToolbar: ['print', 'exports'], // 筛选图标
            parseData: function (res) { //res 即为原始返回的数据
            if (res.code === 1) {
                res.code = 0;
            } else {
                res.code = -1;
            }
            return {
                "code": res.code, //解析接口状态
                "msg": res.message, //解析提示文本
                "count": res.data.total, //解析数据长度
                "data": res.data.data //解析数据列表
            };
        },
            method: 'POST',
            cols: [[
                {field: 'grades_name', title: '班级名称',style:'font-weight: bold;', width: 250, align: 'center'},
                {field: 'headmaster', title: '班主任', style:'font-weight: bold;',minWidth: 100, align: 'center'},
                {field: 'grades_type', title: '班级类型',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'class_start_date', title: '开课时间', style:'font-weight: bold;',width: 170, align: 'center'},
                {field: 'course_name', title: '课程名称',style:'font-weight: bold;', width: 250, align: 'center'},
                {field: 'unit', title: '计费单位', width: 100,style:'font-weight: bold;', align: 'center'},
                {field: 'already_arranged', title: '数量', width: 110, style:'font-weight: bold;',align: 'center'},
                {field: 'class_total_length', title: '课消总时长(小时)',style:'font-weight: bold;', width: 300, align: 'center'},
                {field: 'arrears_total_class', title: '欠费课消',style:'font-weight: bold;', width: 300, align: 'center'},
                {field: 'total_class', title: '总课消', width: 350, style:'font-weight: bold;',align: 'center'},
            ]],
            page: true,
            height: 'full-230',
            done: function (res, curr, count) {
                layer.close(loading);
                //如果是异步请求数据方式，res即为你接口返回的信息。
                //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
            }
        });


        //搜索项
        $('#search_grades').click(function () {
            let field = {};
            field.grades_name = $('select[name=grades_name] option:selected').val();
            field.course_id = $('select[name=course_id_grades] option:selected').val();
            field.campus_id = $('select[name=campus_id_grades] option:selected').val();
            field.grades_type = $('select[name=grades_type_name] option:selected').val();
            var create_date_rang = $('input[name=class_date_grades]').val();
            if(create_date_rang.length > 0){
                strs_date=create_date_rang.split("-"); //字符分割
                field.start_date_class = strs_date[0]+'-'+strs_date[1]+'-'+strs_date[2];
                field.end_date_class = strs_date[3]+'-'+strs_date[4]+'-'+strs_date[5];
            }

            console.log(field);
            tableIns_grades.reload({
                where: field,
                method: 'POST',
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        });
        //清除
        $('#clear_grades').click(function () {
            $('.layui-form-pane').find('.layui-input-inline').each(function (index, element) {
                $(element).find('input[type=text]').val('');
                $(element).find('select').val('');
            })
            tableIns_grades.reload({
                where: {
                    'campus_id': '',
                    'start_date_class': '',
                    'end_date_class': '',
                    'grades_type':'',
                    'course_id': '',
                    'grades_name':'',
                },
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        });


        //按学员
        //方法级渲染
        var tableIns_student = table.render({
            elem: '#datalist_student',
            url: '{:url("elimination/lists")}?type=' + 2,
            toolbar: 'true', //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            defaultToolbar: ['print', 'exports'], // 筛选图标
            parseData: function (res) { //res 即为原始返回的数据
                if (res.code === 1) {
                    res.code = 0;
                } else {
                    res.code = -1;
                }
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.data //解析数据列表
                };
            },
            method: 'POST',
            cols: [[
                {field: 'student_number', title: '学号',style:'font-weight: bold;', width: 250, align: 'center'},
                {field: 'student_name', title: '学员姓名',style:'font-weight: bold;', minWidth: 200, align: 'center'},
                {field: 'class_elimination_one', title: '1V1课消', style:'font-weight: bold;',width: 300, align: 'center'},
                {field: 'class_elimination_one_arrears', style:'font-weight: bold;',title: '1V1欠费课消', width: 300, align: 'center'},
                {field: 'class_elimination_n', title: '1VN课消',style:'font-weight: bold;', width: 300, align: 'center'},
                {field: 'class_elimination_n_arrears',style:'font-weight: bold;', title: '1VN欠费课消', width: 300, align: 'center'},
                {field: 'class_elimination', title: '班课课消',style:'font-weight: bold;', width: 300, align: 'center'},
                {field: 'class_elimination_arrears', title: '班课欠费课消',style:'font-weight: bold;', width: 300, align: 'center'},
                {field: 'class_elimination_total', title: '总课消',style:'font-weight: bold;', width: 300, align: 'center'},
                {field: 'class_elimination_total_arrears', title: '欠费总课消', style:'font-weight: bold;',width: 300, align: 'center'},
            ]],
            page: true,
            height: 'full-230',
            done: function (res, curr, count) {
                layer.close(loading);
                //如果是异步请求数据方式，res即为你接口返回的信息。
                //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
            }
        });

        //搜索项
        $('#search_student').click(function () {
            let field = {};
            field.select_campus = $('select[name=campus_id_student] option:selected').val();
            field.student_name_select = $('input[name=student_name]').val();
            var create_date_rang = $('input[name=date_student_time]').val();
            if(create_date_rang.length > 0){
                strs_date=create_date_rang.split("-"); //字符分割
                field.start_date_elimination = strs_date[0]+'-'+strs_date[1]+'-'+strs_date[2];
                field.end_date_elimination = strs_date[3]+'-'+strs_date[4]+'-'+strs_date[5];
            }

            console.log(field);
            tableIns_student.reload({
                where: field,
                method: 'POST',
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        });
        //清除
        $('#clear_student').click(function () {
            $('.layui-form-pane').find('.layui-input-inline').each(function (index, element) {
                $(element).find('input[type=text]').val('');
                $(element).find('select').val('');
            })
            tableIns_student.reload({
                where: {
                    'select_campus': '',
                    'student_name_select': '',
                    'start_date_elimination': '',
                    'end_date_elimination': '',
                    'date_student_time': '',

                },
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        });


        //按老师
        //方法级渲染
        var tableIns_teacher = table.render({
            elem: '#datalist_teacher',
            url: '{:url("elimination/lists")}?type=' + 3,
            toolbar: 'true', //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            defaultToolbar: ['print', 'exports'], // 筛选图标
            parseData: function (res) { //res 即为原始返回的数据
                if (res.code === 1) {
                    res.code = 0;
                } else {
                    res.code = -1;
                }
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.data //解析数据列表
                };
            },
            method: 'POST',
            cols: [[
                {field: 'teacher_name', title: '老师姓名',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'grades_nums', title: '班级数',style:'font-weight: bold;', minWidth: 200, align: 'center'},
                {field: 'grades_info_class_nums', title: '上课次数', style:'font-weight: bold;',width: 200, align: 'center'},
                {field: 'grades_class_length', style:'font-weight: bold;',title: '上课时长', width: 200, align: 'center'},
                {field: 'class_elimination_one', title: '1V1课消',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'class_elimination_one_arrears',style:'font-weight: bold;', title: '1VN欠费课消', width: 200, align: 'center'},
                {field: 'class_elimination_n', title: '1VN课消',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'class_elimination_n_arrears', title: '1VN欠费课消',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'class_elimination', title: '班课课消',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'class_elimination_arrears', title: '班课欠费课消',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'class_elimination_total', title: '总课消',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'class_elimination_total_arrears', title: '欠费总课消', style:'font-weight: bold;',width: 200, align: 'center'},
            ]],
            page: true,
            height: 'full-230',
            done: function (res, curr, count) {
                layer.close(loading);
                //如果是异步请求数据方式，res即为你接口返回的信息。
                //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
            }
        });


        //搜索项
        $('#search_teacher').click(function () {
            let field = {};
            field.select_campus = $('select[name=campus_id_teacher] option:selected').val();
            field.teacher_name = $('input[name=teacher_name]').val();
            var create_date_rang = $('input[name=date_teacher_time]').val();
            if(create_date_rang.length > 0){
                strs_date=create_date_rang.split("-"); //字符分割
                field.start_date_elimination = strs_date[0]+'-'+strs_date[1]+'-'+strs_date[2];
                field.end_date_elimination = strs_date[3]+'-'+strs_date[4]+'-'+strs_date[5];
            }

            console.log(field);
            tableIns_teacher.reload({
                where: field,
                method: 'POST',
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        });
        //清除
        $('#clear_teacher').click(function () {
            $('.layui-form-pane').find('.layui-input-inline').each(function (index, element) {
                $(element).find('input[type=text]').val('');
                $(element).find('select').val('');
            })
            tableIns_teacher.reload({
                where: {
                    'select_campus': '',
                    'teacher_name': '',
                    'start_date_elimination': '',
                    'end_date_elimination': '',
                    'date_teacher_time': '',

                },
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        });



        //按课消明细
        //方法级渲染
        var tableIns_info = table.render({
            elem: '#datalist_info',
            url: '{:url("elimination/lists")}?type=' + 5,
            toolbar: 'true', //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            defaultToolbar: ['print', 'exports'], // 筛选图标
            parseData: function (res) { //res 即为原始返回的数据
                if (res.code === 1) {
                    res.code = 0;
                } else {
                    res.code = -1;
                }
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.data //解析数据列表
                };
            },
            method: 'POST',
            cols: [[
                {field: 'student_number', title: '学号',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'student_name', title: '学生姓名',style:'font-weight: bold;', minWidth: 200, align: 'center'},
                {field: 'student_grade', title: '年级', style:'font-weight: bold;',width: 200, align: 'center'},
                {field: 'course_name', style:'font-weight: bold;',title: '课程', width: 200, align: 'center'},
                {field: 'grades_name', title: '班级名称',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'grades_type',style:'font-weight: bold;', title: '班级类型', width: 200, align: 'center'},
                {field: 'teacher_name', title: '任课老师',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'assistant_name', title: '助教',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'headmaster_name', title: '班主任',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'class_time', title: '上课时间',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'class_duration', title: '上课时长',style:'font-weight: bold;', width: 200, align: 'center'},
                {field: 'eliminated_nums_text', title: '课消节数', style:'font-weight: bold;',width: 200, align: 'center'},
                {field: 'attendance_text', title: '签到状态', style:'font-weight: bold;',width: 200, align: 'center'},
                {field: 'operatorer_name', title: '操作人', style:'font-weight: bold;',width: 200, align: 'center'},
            ]],
            page: true,
            height: 'full-230',
            done: function (res, curr, count) {
                layer.close(loading);
                //如果是异步请求数据方式，res即为你接口返回的信息。
                //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
            }
        });


        //搜索项
        $('#search_info').click(function () {
            let field = {};
            field.campus_id = $('select[name=campus_id_info] option:selected').val();
            field.grades_name_info = $('select[name=grades_name_info] option:selected').val();
            field.course_id = $('select[name=course_id_info] option:selected').val();
            field.grades_type_info = $('select[name=grades_type_info] option:selected').val();
            field.headmaster_name_info = $('input[name=headmaster_name_info]').val();
            field.teacher_name_info = $('input[name=teacher_name_info]').val();
            field.assistant_name_info = $('input[name=assistant_name_info]').val();
            field.student_name_info = $('input[name=student_name_info]').val();
            var create_date_rang = $('input[name=date_info_time]').val();
            if(create_date_rang.length > 0){
                strs_date=create_date_rang.split("-"); //字符分割
                field.start_date_class = strs_date[0]+'-'+strs_date[1]+'-'+strs_date[2];
                field.end_date_class = strs_date[3]+'-'+strs_date[4]+'-'+strs_date[5];
            }

            console.log(field);
            tableIns_info.reload({
                where: field,
                method: 'POST',
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        });
        //清除
        $('#clear_info').click(function () {
            $('.layui-form-pane').find('.layui-input-inline').each(function (index, element) {
                $(element).find('input[type=text]').val('');
                $(element).find('select').val('');
            })
            tableIns_info.reload({
                where: {
                    'campus_id': '',
                    'teacher_name': '',
                    'grades_type_info': '',
                    'grades_name_info':'',
                    'headmaster_name_info':'',
                    'assistant_name_info':'',
                    'teacher_name_info': '',
                    'student_name_info':'',
                    'course_id': '',
                    'start_date_class': '',
                    'end_date_class': '',
                    'date_info_time': '',

                },
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        });


        //班主任明细
        //方法级渲染
        var tableIns_headmaster = table.render({
            elem: '#datalist_headmaster',
            url: '{:url("elimination/lists")}?type=' + 4,
            toolbar: 'true', //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            defaultToolbar: ['print', 'exports'], // 筛选图标
            parseData: function (res) { //res 即为原始返回的数据
                if (res.code === 1) {
                    res.code = 0;
                } else {
                    res.code = -1;
                }
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.data //解析数据列表
                };
            },
            method: 'POST',
            cols: [[
                {field: 'headmaster_name', title: '班主任姓名',style:'font-weight: bold;', width: 250, align: 'center'},
                {field: 'grades_nums', title: '班级数',style:'font-weight: bold;', minWidth: 200, align: 'center'},
                {field: 'student_nums', title: '学员数',style:'font-weight: bold;', minWidth: 200, align: 'center'},
                {field: 'class_elimination_one', title: '1V1课消', style:'font-weight: bold;',width: 300, align: 'center'},
                {field: 'class_elimination_one_arrears', style:'font-weight: bold;',title: '1V1欠费课消', width: 300, align: 'center'},
                {field: 'class_elimination_n', title: '1VN课消',style:'font-weight: bold;', width: 300, align: 'center'},
                {field: 'class_elimination_n_arrears',style:'font-weight: bold;', title: '1VN欠费课消', width: 300, align: 'center'},
                {field: 'class_elimination', title: '班课课消',style:'font-weight: bold;', width: 300, align: 'center'},
                {field: 'class_elimination_arrears', title: '班课欠费课消',style:'font-weight: bold;', width: 300, align: 'center'},
                {field: 'class_elimination_total', title: '总课消',style:'font-weight: bold;', width: 300, align: 'center'},
                {field: 'class_elimination_total_arrears', title: '欠费总课消', style:'font-weight: bold;',width: 300, align: 'center'},
            ]],
            page: true,
            height: 'full-230',
            done: function (res, curr, count) {
                layer.close(loading);
                //如果是异步请求数据方式，res即为你接口返回的信息。
                //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
            }
        });

        //搜索项
        $('#search_headmaster').click(function () {
            let field = {};
            field.campus_id = $('select[name=campus_id_headmaster] option:selected').val();
            var create_date_rang = $('input[name=date_headmaster_time]').val();
            field.headmaster_name = $('input[name=headmaster_name]').val();
            if(create_date_rang.length > 0){
                strs_date=create_date_rang.split("-"); //字符分割
                field.start_date_elimination = strs_date[0]+'-'+strs_date[1]+'-'+strs_date[2];
                field.end_date_elimination = strs_date[3]+'-'+strs_date[4]+'-'+strs_date[5];
            }

            console.log(field);
            tableIns_headmaster.reload({
                where: field,
                method: 'POST',
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        });
        //清除
        $('#clear_headmaster').click(function () {
            $('.layui-form-pane').find('.layui-input-inline').each(function (index, element) {
                $(element).find('input[type=text]').val('');
                $(element).find('select').val('');
            })
            tableIns_headmaster.reload({
                where: {
                    'campus_id': '',
                    'start_date_elimination': '',
                    'end_date_elimination': '',
                    'headmaster_name': '',

                },
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        });
    });
</script>
